package
{
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	import mx.core.mx_internal;

	public class WorldObject implements ISpatialIndexable
	{
		public var display:Sprite;
		private var m_rectangle:Rectangle;
		
		public function WorldObject()
		{
			m_rectangle = new Rectangle;
		}
		
		public function set size(pnt:Point):void{
			m_rectangle.size = pnt;
		}
		
		public function get size():Point{
			return m_rectangle.size.clone();
		}	
		
		public function getRect():Rectangle{
			return m_rectangle;
		}
		
		public function set location(pnt:Point):void{
			m_rectangle.x = pnt.x;
			m_rectangle.y = pnt.y;
		}
		
		public function get location():Point{
			return m_rectangle.topLeft;
		}		
		
		public function initialize():void{
			display = Util.getRect(m_rectangle.width * Global.PPU, m_rectangle.height * Global.PPU,0xaaaaaa);			
			display.alpha = 1;
			updateDisplay();
		}
		
		public function updateDisplay():void{
			display.x = location.x * Global.PPU;
			display.y = location.y * Global.PPU;			
		}
		
	}
}